<template>
    <div class="con">
        <div class="header">
            <img src="../assets/images/new/bg.png" alt class="bg" />
            <div class="content">
                <img src="../assets/images/new/logo.png" alt class="logo" />
                <br>
                <img src="../assets/images/new/title.png" alt class="tip" />
                    <br>
                <button @click="downApp()">点击安装</button>
                
                <img src="../assets/images/new/footer.png" alt class="footer" />
            </div>
        </div>

        <Shade v-show="showWx"></Shade>
    </div>
</template>

<script>
import Shade from "./shade";
export default {
    components: {
        Shade
    },
    name: "index",
    data() {
        return {
            show: true,
            showWx: false,
            swiperOption: {
                pagination: ".swiper-pagination",
                loop: true
            }
        };
    },
    methods: {
        downApp() {
            let ua = navigator.userAgent.toLowerCase();
            let userAgent = navigator.userAgent.toLowerCase();
            //android终端
            let isAndroid =
                ua.indexOf("Android") > -1 || ua.indexOf("Adr") > -1; //ios终端
            let isiOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            if (isWeixinBrowser()) {
                console.log(1);
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    window.location =
                        "https://itunes.apple.com/cn/app/id1503125517";
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    this.showWx = true;
                }
            } else if (userAgent.match(/Alipay/i) == "alipay") {
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    window.location =
                        "https://itunes.apple.com/cn/app/id1503125517";
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    //android
                    this.showWx = true;
                }
            } else {
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    //ios
                    window.location =
                        "https://itunes.apple.com/cn/app/id1503125517";

                    // alert("ios")
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    //android

                    window.location =
                        "http://pda.aixuepai.com.cn:8060/appUpdate/Download/business/business.apk";
                } else {
                    window.location =
                        "http://pda.aixuepai.com.cn:8060/appUpdate/Download/business/business.apk";
                }
            }

            function isWeixinBrowser() {
                return /micromessenger/.test(ua) ? true : false;
            }
        }
    }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.con {
    width: 100%;
    height: 100vh;
}
.header {
    position: relative;

    width: 100%;
    height: 100vh;
    text-align: center;
}
.header .bg {
    width: 100%;
    height: 100vh;
}
.content {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100vh;
}
.header .logo {
    width: 112px;
    height: 79px;
    margin: 0 auto;
    margin-top: 56px;
}
.tip {
    margin: 0 auto;
    margin-top: 36px;
    width: 272px;
    height: 41px;
}

button {
    width: 120px;
    height: 44px;
    border-radius: 22px;
    background: #ff7a40;
    line-height: 44px;
    color: #fff;
    font-size: 16px;
    margin-top: 66px;
}
.footer {
    position: absolute;
    left: 0px;
    bottom: 0px;
    width: 100%;
}
</style>
